package cn.com.open.itembank.common.enums;

/**
 * Created by lucky on 2017/7/17.
 */

/**
 * 是否：0，否；1，是
 */
public enum YesOrNo {
    /**
     * 否（默认）
     */
    NO(0),
    /**
     * 是
     */
    YES(1);

    private Integer index;

    YesOrNo(Integer idx) {
        this.index = idx;
    }

    /**
     * Gets index.
     *
     * @return the index
     */
    public Integer getIndex() {
        return index;
    }

    public static YesOrNo fromValue(Integer v) {
        for (YesOrNo c : YesOrNo.values()) {
            if (c.getIndex() == v) {
                return c;
            }
        }
        return null;
    }
}
